<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="model.*"%>
<%@ page import="dao.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	request.setCharacterEncoding("utf-8");
	response.setCharacterEncoding("utf-8");
	String user = (String)session.getAttribute("user");
	if(user!=null && user.equals("1")){
		
	}else {
		response.sendRedirect("Login.jsp");
	}
%>
<%
	List<Strategy> strategys = new ArrayList<Strategy>();
	strategys = StrategyDao.getStrategys();
	for (Strategy item : strategys) {
		System.out.println(item.getId());
	}
	request.setAttribute("strategys", strategys);
%>
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8" />
<title>管理旅游攻略</title>


<jsp:include page="Header.jsp" flush="true"></jsp:include>
<style>
</style>

<!-- Latest Products -->
<div id="管理旅游攻略">
	<div class="content-lg container">
		<div class="row margin-b-40">
			<div class="col-sm-6">
				<h2>管理旅游攻略</h2>
				<p></p>
			</div>
		</div>
		<!--// end row -->
		<div class="content-lg container sm-margin-t-0">
			<div class="masonry-grid row">
				<h3>
					<a href="<%=request.getContextPath()%>/admin/AddStrategy.jsp">添加攻略</a>
				</h3>

				<c:forEach var="strategy" items="${strategys}" varStatus="status">
					<c:choose>
						<c:when test="${(status.index+1 )%2 =='0'}">

							<div style="height: 600px;"
								onclick="window.open('<%=request.getContextPath()%>/admin/StrategyInfo.jsp?sid=${strategy.id }')"
								class="masonry-grid-item col-xs-12 col-sm-6 col-md-6">
								<div style="height: 600px;">
									<div class="margin-b-60">${strategy.getUrl() }</div>
									<h2>${strategy.name }</h2>
								</div>
							</div>
						</c:when>
						<c:otherwise>

							<div
								onclick="window.open('<%=request.getContextPath()%>/admin/StrategyInfo.jsp?sid=${strategy.id }')"
								class="masonry-grid-item col-xs-12 col-sm-6 col-md-6 sm-margin-b-30">
								<div style=" height: 600px;">
									<div class="margin-b-60">
										<h2>${strategy.name }</h2>
									</div>
									${strategy.getUrl() }

								</div>
							</div>
						</c:otherwise>
					</c:choose>

				</c:forEach>


			</div>
			<!--// end row -->
		</div>
	</div>
</div>
<!-- End Latest Products -->

<jsp:include page="Footer.jsp" flush="true"></jsp:include>
<script>
	window.onload = function() {
		var obj = document.getElementByclassName('masonry-grid-item');
		obj.onclick = function() {
			window.location.href = "www.hao123.com";
		}
	}
</script>
<!-- Back To Top -->
<a href="javascript:void(0);" class="js-back-to-top back-to-top">Top</a>

<!-- JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- CORE PLUGINS -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/jquery-migrate.min.js" type="text/javascript"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"
	type="text/javascript"></script>
</body>
<!-- END BODY -->
</html>